package com.ssy.lingxi.purchase.entity.tender;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonManagedReference;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;
import java.util.List;

/**
 * 评标专家抽取
 * @author jw.chen
 * @version 2.0.0
 * @date 2021/3/1
 */
@Getter
@Setter
@Entity
@Table(schema = "public", name = "purchase_evaluation_tender_expert_extract")
public class ExpertExtract implements Serializable {
    private static final long serialVersionUID = 6316615343293320067L;
    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="evaluation_tender_expert_extract_seq")
    @SequenceGenerator(sequenceName="purchase_evaluation_tender_expert_extract_seq", name="evaluation_tender_expert_extract_seq",allocationSize = 1)
    private Long id;

    /**
     * 名称
     */
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String name;

    /**
     * 招标id
     */
    @JsonIgnore
    @ManyToOne(cascade = {CascadeType.PERSIST})
    @JoinColumn(name="inviteTenderId",referencedColumnName = "id")
    private InviteTender inviteTender;

    /**
     * 评标专家抽取条件
     */
    @JsonManagedReference
    @OneToMany(mappedBy = "expertExtract", cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})
    private List<ExpertExtractQuery> expertExtractQueryList;

    /**
     * 评标专家抽取记录
     */
    @JsonManagedReference
    @OneToMany(mappedBy = "expertExtract", cascade={CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REMOVE})
    private List<ExpertExtractRecord> expertExtractRecordList;

    /**
     * 状态: false-待发送; true-已发送;
     */
    @Column(columnDefinition = "boolean", nullable = false)
    private Boolean status = false;

    /**
     * 会员id
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long memberId;

    /**
     * 会员名称
     */
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String memberName;

    /**
     * 会员角色id
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long memberRoleId;

    /**
     * 会员角色名称
     */
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String memberRoleName;

    /**
     * 用户id
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long userId;

    /**
     * 用户名称
     */
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String userName;

    /**
     * 创建时间
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long createTime = System.currentTimeMillis();
}
